<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Tbeannsitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html;charset=UTF-8"
	import="com.srit.forecast.constant.Constant"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="srit-tag" uri="/srit-constant-tag"%>
<srit-tag:Constant var="PAGE_TYPE_FORM" />
<srit-tag:Constant var="PAGE_TYPE_LIST" />
<srit-tag:Constant var="PAGE_TYPE_ALL" />
<srit-tag:Constant var="GRID_ATTR_SELECT" />
<html>
<head>
<title></title>
<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet"
	type="text/css">
<link href="<c:url value="/resources/css/list_css.css" />"
	rel="stylesheet" type="text/css">

<script src="<c:url value="/resources/js/jquery-1.8.0.min.js" />"></script>
</head>

<!-- 搜索 -->
<c:if test="${pageType==PAGE_TYPE_ALL}">
	<div id="SearchDiv"></div>
</c:if>

<!-- 表单页 -->
<c:if test="${pageType==PAGE_TYPE_FORM||pageType==PAGE_TYPE_ALL}">
	<div id="createDiv">
		<form:form modelAttribute="gridAttribute"
			action="/gridAttribute-saveOrUpdate" method="post">
			<form:hidden path="id" />
			<table class="sritTable" align='center' id="table" width="98%">
				<tr>
					<th colspan="6">表单属性</th>
				</tr>
				<tr>
					<td class="td_tl">类型名称</td>
					<td><form:input path="name" /></td>
					<td class="td_tl">显示类型</td>
					<td><form:select path="showType" id="showType"
							items="${showTypeList}" onchange="showCodeType()" /> <script>
								function showCodeType() {
									if ($("#showType").val() == '${GRID_ATTR_SELECT}') {
										$("#codeType").val(
												$("#codeTypeHidden").val());
										$("#codeType").attr("disabled", false)
									} else {
										$("#codeType").val("");
										$("#codeType").attr("disabled", true)
									}
								}
							</script></td>
					<td class="td_tl">代码类型</td>
					<td><c:if test="${gridAttribute.showType==GRID_ATTR_SELECT}">
							<c:set value="false" var="disabled"></c:set>
						</c:if> <c:if test="${gridAttribute.showType!=GRID_ATTR_SELECT}">
							<c:set value="true" var="disabled"></c:set>
						</c:if> <form:select path="codeType" id="codeType"
							disabled="${disabled }">
							<form:option value="" label="--Please Select" />
							<form:options items="${codeTypeList}" itemValue="id"
								itemLabel="type" />
						</form:select> <input type="hidden" id="codeTypeHidden"
						value="${gridAttribute.codeType}" /></td>
				</tr>
				<tr>
					<td colspan="6" class="td_tl"><c:if
							test="${gridAttribute.id==null}">
							<input type="submit" value="保存" />
						</c:if> <c:if test="${gridAttribute.id!=null }">
							<input type="submit" value="修改" />
						</c:if> <input type="reset" /></td>
				</tr>
			</table>
		</form:form>
	</div>
</c:if>

<!-- 列表页 -->
<c:if test="${pageType==PAGE_TYPE_LIST||pageType==PAGE_TYPE_ALL}">
	<div id="pageDiv">
		<div>
			<a href="<c:url  value="/gridAttribute-form"></c:url>">创建</a>
		</div>
		<table class="sritTable" align='center' id="table" width="98%"
			style="margin-top: 5px">
			<tr>
				<th><input type="checkbox" /></th>
				<th>name</th>
				<th>showtype</th>
				<th>codetype</th>
			</tr>
			<c:forEach var="bean" items="${page.list}">
				<tr onMouseOver="javascript:this.style.backgroundColor='#AABBFF';"
					onMouseOut="javascript:this.style.backgroundColor='#FFFFFF';"
					ondblclick="javascript:window.location='<c:url  value="/gridAttribute-edit">
					<c:param name="id" value="${bean.id }"/>
					</c:url>'">
					<td><input type="checkbox" value="${bean.id }" /></td>
					<td>${bean.name }</td>
					<td>${bean.showType }</td>
					<td>${bean.codeType }</td>
				</tr>
			</c:forEach>
		</table>

		<table class="sritTable" align='center' id="table" width="98%"
			style="margin-top: 0px">
			<tr>
				<td class="td_tl">${page.count},${page.pageNum}</td>
			</tr>
		</table>
	</div>
</c:if>
</html>




